package com.yanqu.road.server.game.service;

import com.yanqu.road.server.command.CommandControl;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.HashMap;
import java.util.Map;

public class GameService {
    private  final Map<Integer, IGameServiceCommand> gameServiceCommandHashMap = new HashMap<>();
    private  Logger logger = LogManager.getLogger(CommandControl.class.getName());

    public IGameServiceCommand getCommand(int code) {
        try {
            return gameServiceCommandHashMap.get(code);
        } catch (Exception e) {
            logger.error("获取 Command 异常, Command Code: {}", code, e);
            return null;
        }
    }
    public GameService() {

    }

    public void addGameServiceCommand(int code, IGameServiceCommand iGameServiceCommand) {
        gameServiceCommandHashMap.put(code, iGameServiceCommand);
    }

}
